<template>
  <div class="contentbox">
    <div v-if="attachmentsList && attachmentsList.length != 0" class="fujianList">
      <fujian @fuzhiFunc="setItemData" :fujianList="attachmentsList"></fujian>
    </div>
    <div v-if="showBox" class="fujianAnswer">
      <annex-opinions
        v-if="showBox"
        :firstLinkName="firstLinkName"
        :ref="itemData.fileType"
        :file="itemData"
        :linkName="linkName"
        :projectId="projectId"
      ></annex-opinions>
    </div>
    <div v-if="!attachmentsList || attachmentsList.length == 0" class="no-data">
      暂无数据
    </div>
  </div>
</template>

<script>
import annexOpinions from "./annexSub/annexOpinions";
import fujian from "@/components/fujianListForThree";
export default {
  components: {
    annexOpinions,
    fujian
  },
  data() {
    return {
      annexTabs: `annexOpinions0`,
      itemData:null,
      showBox:false,
    };
  },
  props: {
    attachmentsList: {
      type: Array,
      require: true,
      default: () => []
    },
    projectId: {
      type: Number,
      require: true
    },
    linkName: {
      type: String,
      require: true
    },
    firstLinkName: {
      type: String,
      require: true
    }
  },
  created() {},
  methods: {
    setItemData(data){
      console.log(data)
      this.itemData = data
      this.showBox = true
      this.$forceUpdate()
    },
    exportAnnexOpinionByType(fileType) {
      if (this.$refs[fileType]) {
        this.$refs[fileType].getExport();
      }
    }
  }
};
</script>

<style lang="scss" scoped >
.contentbox {
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  // -webkit-align-items: center;
  // align-items: center;
  .fujianList{
    width: 25%;
  }
  .fujianAnswer{
    width: 75%;
  }
}
</style>

